package com.zjitc.controller;

import com.zjitc.model.Country;
import com.zjitc.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.InternalResourceView;

import java.util.List;

/**
 * Created by Administrator on 2018/3/20.
 */
@Controller
public class CountryController {
    @Autowired
    private CountryService countryService;

    @RequestMapping("/findAllCountry")
    public ModelAndView findAll(){
        List<Country> listCountrys = countryService.findAll();
        ModelAndView mv = new ModelAndView();
        mv.addObject("countrys",listCountrys);
        mv.setViewName("/WEB-INF/views/countrys.jsp");
        return mv;
    }
    @RequestMapping("/addAll")
    public View addAll(){
        View view = new InternalResourceView("/WEB-INF/views/addCountry.jsp");
        return view;
    }
    @RequestMapping("/addCountry")
    public ModelAndView add(){
        ModelAndView mv = new ModelAndView();

        return mv;
    }
}
